package cn.hackcloud.designpattern.iterator;

import java.util.Iterator;

public class ComputerCollege implements College {
	Department[] departments;
	int num = 0;

	public ComputerCollege() {
		super();
		departments = new Department[5];
		addDepartment("java", "java");
		addDepartment("PHP", "PHP");
		addDepartment("大数据", "大数据");
	}

	@Override
	public String getName() {
		return "计算机学院";
	}

	@Override
	public void addDepartment(String name, String desc) {
		Department department = new Department(name, desc);
		departments[num] = department;
		num += 1;
	}

	@Override
	public Iterator createIterator() {
		return new ComputerIterator(departments);
	}

}
